﻿//======================================================
//==     (c)2008 aspxcms inc by NeTCMS v1.0              ==
//==          Forum:bbs.aspxcms.com                   ==
//==         Website:www.aspxcms.com                  ==
//======================================================
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NetCMS.Content;

public partial class manage_channel_ContentToSpecial : NetCMS.Web.UI.ManagePage
{
    Channel rd = new Channel();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["ChID"] == null && Request.QueryString["ChID"] == string.Empty)
        {
            PageError("错误的参数", "javascript:history.back();", true);
        }
        GetSpecialList(this.GSpecialID, 0, 0);
    }

    protected void GetSpecialList(DropDownList lst, int ParentID, int Layer)
    {
        IDataReader dr = rd.getSpecialList(ParentID, int.Parse(Request.QueryString["ChID"]));
        while (dr.Read())
        {
            ListItem it = new ListItem();
            string stxt = "";
            it.Value = dr["ID"].ToString();
            if (Layer > 0)
                stxt = "┝";
            for (int i = 1; i < Layer; i++)
            {
                stxt += " ┉ ";
            }
            it.Text = stxt + dr["specialCName"].ToString();
            lst.Items.Add(it);
            GetSpecialList(lst, int.Parse(dr["ID"].ToString()), (Layer + 1));
        }
        dr.Close();
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        string id = NetCMS.Common.Input.URLDecode(Request.QueryString["id"]);
        int ChID = int.Parse(Request.QueryString["ChID"]);
        if (this.GSpecialID.SelectedValue == null)
        {
            PageError("选择专题", "javascript:history.back();", true);
        }
        rd.updateInfoSpecial(id, this.GSpecialID.SelectedValue, ChID);
        PageRight("更新成功", "Content.aspx?ChID=" + ChID.ToString() + "", true);
    }
}
